package 剑指offer;

public class p58_2左旋转字符串 {
    public String reverseLeftWords(String s, int n) {
        String left = s.substring(0, n);//将需要左旋的字符串截取出来

        String right=s.substring(n,s.length());

        StringBuilder res=new StringBuilder(right);//String转StringBuilder，创建StringBuilder对象，利用构造方法传入String参数即可

        res.append(left);

        return res.toString();

    }

    public String reverseLeftWords2(String s, int n) {
        return s.substring(n,s.length())+s.substring(0,n);

    }
}
